package com.example.birdfriends;

import com.example.birdfriends.pojo.post.PostFront;
import com.example.birdfriends.utils.recommend.RecommendUtil;
import org.wltea.analyzer.core.IKSegmenter;
import org.wltea.analyzer.core.Lexeme;

import java.io.IOException;
import java.io.StringReader;
import java.sql.Time;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

public class Test {
    public static List<String> cur(String msg) throws IOException {
        StringReader sr = new StringReader(msg);
        IKSegmenter ik = new IKSegmenter(sr, true);
        Lexeme lex = null;
        List<String> list = new ArrayList<>();
        while ((lex=ik.next()) != null){
            list.add(lex.getLexemeText());
        }

        return list;
    }

    public static void main(String[] args) throws IOException, ParseException {
        HashMap<String, Integer> map = new HashMap<>();
        for (int i = 0; i < 10; i++){
            map.put(i+"", i);
        }

        System.out.println("map info:"+map.get("20"));
    }

    public static int timeDiffer(Timestamp t1, Timestamp t2){
        long dayM = 1000*24*60*60;
        long hourM = 1000*60*60;
        long differ = t2.getTime() - t1.getTime();
        long hour = differ % dayM / hourM + 24 * (differ / dayM);
        return Integer.parseInt(String.valueOf(hour));
    }
}
